﻿using System.Windows;
using System.Windows.Media.Imaging;
using Game.Map;
using Game.Objects;
using Game.Types;

namespace Game.Toolkit
{
    public class GameObjectGroupPart
    {
        readonly GameDirection _GameDirection;
        readonly BuildingType _BuildingType;
        readonly string _Name;
        readonly BitmapImage _Image;
        
        public GameObjectGroupPart(
            GameDirection gameDirection, 
            string name,
            BitmapImage image,
            BuildingType buildingType = null)
        {
            _GameDirection = gameDirection;
            _Name = name;
            _Image = image;
            _BuildingType = buildingType;
        }
        
        public GameDirection GameDirection
        {
            get { return _GameDirection; }
        }
        
        public Point GetPoint(Point center)
        {
            double x = (center.X + _GameDirection.Value.X);
            double y = (center.Y + _GameDirection.Value.Y);
            return new Point(x, y);
        }
        
        public ObjectType ObjectType
        {
            get 
            {
                var builder = new ObjectTypeBuilder();
                builder.Name = _Name + _GameDirection.ToString();
                builder.Picture = _Image;
                builder.DefenseBonusPlus = 100;
                builder.AttackBonusPlus = 30;
                builder.BuildingType = _BuildingType;
                return builder.BuildObjectType();
            }
        }
        
    }
    
}
